//
//  MenuDarenHeaderCollectionReusableView.m
//  Products_B
//
//  Created by lanou on 16/6/4.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "MenuDarenHeaderCollectionReusableView.h"

@implementation MenuDarenHeaderCollectionReusableView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.picImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 200)];
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 200, kWidth - 20, 30)];
        self.titleLabel.font = [UIFont systemFontOfSize:13];
        self.titleLabel.numberOfLines = 0;
        self.iconImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 240, 50, 50)];
        self.iconImageView.layer.cornerRadius = 25;
        self.iconImageView.layer.masksToBounds = YES;
        self.zanButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        [self.zanButton setBackgroundImage:[UIImage imageNamed:@"menubofang"] forState:(UIControlStateNormal)];
        
        self.zanButton.frame = CGRectMake(40, 280, 10, 10);
        self.zanButton.layer.cornerRadius = 10;
        self.zanButton.layer.masksToBounds = YES;
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(70, 250, 200, 20)];
        self.nameLabel.font = [UIFont systemFontOfSize:13];
        self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(70, 270, 200, 20)];
        self.timeLabel.font = [UIFont systemFontOfSize:13];
        self.timeLabel.textColor = [UIColor grayColor];
        self.guanzhuButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        self.guanzhuButton.frame = CGRectMake(kWidth - 60, 260, 40, 30);
        [self.guanzhuButton setTitle:@"关注" forState:(UIControlStateNormal)];
    
        [self.guanzhuButton setTintColor:[UIColor orangeColor]];
        
       
     
            
            _label = [[UILabel alloc]initWithFrame:CGRectMake(10, 290, 110, 20)];
            _label.font = [UIFont systemFontOfSize:13];
        _label.textAlignment = NSTextAlignmentRight;
            _zanButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
            _zanButton.frame = CGRectMake(120, 290, 20, 20);
            _zanButton.backgroundColor = [UIColor magentaColor];
        
        
        
        
        
//        self.moreButton1 = [UIButton buttonWithType:(UIButtonTypeSystem)];
//        self.moreButton1.frame = CGRectMake(30+10, 0, bounds.size.width, 30);
//        [self.moreButton1 setTintColor:[UIColor orangeColor]];
//        self.moreButton1.titleLabel.font = [UIFont systemFontOfSize:13];
//        [self.moreButton1 setTitle:model.topic_name forState:(UIControlStateNormal)];
//        
//        [self.moreButton1 addTarget:self action:@selector(moreButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
//        UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(30+10 + bounds.size.width, 0, 50, 30)];
//        label2.font = [UIFont systemFontOfSize:13];
//        label2.text = @"的作品";
        
//        [_myView addSubview:_label];
//        [_myView addSubview:label2];
//        [_myView addSubview:_moreButton1];
//            [_myView addSubview:_label];
//            [_myView addSubview:_zanButton];
//            [_headView addSubview:_myView];
      
        [self addSubview:_picImageView];
        [self addSubview:_titleLabel];
        [self addSubview:_iconImageView];
        [self addSubview:_zanButton];
        [self addSubview:_nameLabel];
        [self addSubview:_timeLabel];
        [self addSubview:_guanzhuButton];
        [self addSubview:_label];
        [self addSubview:_guanzhuButton];
        
        
        
    }
    return self;
}
- (void)setModel:(MenuDarenZuoPIngModel *)model{
    NSLog(@"%@",model.head_img);
    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:nil completed:nil];
    self.nameLabel.text = model.nick;
    self.titleLabel.text = model.content;
    self.timeLabel.text = model.create_time;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.head_img] placeholderImage:nil completed:nil];
    self.label.text = [NSString stringWithFormat:@"%@为厨友觉得很赞",model.agree_count];
}
@end
